@extends('admin.main_table')
@section('title', '管理员管理')

@section('css')
    <link href="{{ asset('/static/css/admin/admin.css') }}" rel="stylesheet">
    <style>
        .pagination-detail {
            margin-left: 20px;
        }

        .pagination {
            margin-right: 20px;
        }
    </style>
@endsection

@section('content')
    <div class="col-md-12 main_body">
        <div style="margin-bottom:10px;">
            <button class="btn btn-default" type="button" id="add" disabled="disabled"><img
                        src="{{ asset('/static/img/新增.png') }}" style="width:18px;height:18px;"/>&nbsp;新增
            </button>
            <button class="btn btn-default" type="button" id="delete" disabled="disabled"><img
                        src="{{ asset('/static/img/删除.png') }}" style="width:18px;height:18px;"/>&nbsp;删除
            </button>
            <button class="btn btn-default" type="button" id="change" disabled="disabled"><img
                        src="{{ asset('/static/img/修改.png') }}" style="width:18px;height:18px;"/>&nbsp;修改
            </button>
        </div>

        <table data-toggle="table" id="admin_table"></table>
    </div>
@endsection

@section('script')
    <script>
        $(function () {
            $(".admin_nav").addClass('active');
            $(".admin_nav").find(".nav-second-level").addClass('in');
            $($(".admin_nav > .nav-second-level").children("li").get(1)).addClass('active');
        });

        function initTable() {
            var $table = $('#admin_table');
            $table.bootstrapTable({
                pagination: true, //分页
                url: '/admin/getAllAdminOperate',
                pageList: [15, 30, 50],
                columns: [{
                    checkbox: true
                }, {
                    field: 'id',
                    title: '管理员id'
                }, {
                    field: 'adminName',
                    title: '管理员姓名'
                }, {
                    field: 'content',
                    title: '操作'
                }, {
                    field: 'created_at',
                    title: '创建时间'
                }]
            });
            /*$table.bootstrapTable('hideColumn', 'id');*/
        }

        initTable();

        /* $("#add").click(function(){
             window.location="/addAdmin";
         });
         $('#delete').click(function () {
             var row=$('#admin_table').bootstrapTable('getSelections');
             $.post('/deleteAdmin',{'row':row},function(data){
                 window.location="/adminManage";
             })
         });
         $("#change").click(function(){
             var row=$('#admin_table').bootstrapTable('getSelections');
             var id=row[0].id;
             //alert(id)
             //console.log(id);
             window.location="/updateAdmin?id="+id;
         });*/
    </script>

@endsection